-- revive_attrib_up
-- created by panyl
-- 复活增强

return {
    apply = function(prop, baseValue)
        return baseValue + math.modf(baseValue * prop[3] / 1000);
    end,

    -- 死亡触发
    trigger = function(who, prop, arg)
        local propId = PropM.getPropId("attrib2");
        local round = prop[4];

        if round > 0 then
            round = CombatM.getRound() + round;
        end

        local v;
        if prop[2] == "attack" then
            v = math.modf(who:getAttack() * prop[3] / 1000);
        elseif prop[2] == "magic" then
            v = math.modf(who:getMagic() * prop[3] / 1000);
        elseif prop[2] == "hp" then
            v = math.modf(who:getHp() * prop[3] / 1000);
        elseif prop[2] == "max_hp" then
            v = math.modf(who:getMaxHp() * prop[3] / 1000);
        elseif prop[2] == "mp" then
            v = math.modf(who:getMp() * prop[3] / 1000);
        elseif prop[2] == "max_mp" then
            v = math.modf(who:getMaxMp() * prop[3] / 1000);
        else
            v = 0;
        end

        local arr = { propId, prop[2], v, round, };

        -- 附加属性
        PropM.record(who, arr, "mixed");

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
